const router = require('koa-router')();
const project = require('../../controller/project/project.controller');
const building = require('../../controller/project/building.controller');
const houseType = require('../../controller/project/houseType.controller');
const room = require('../../controller/room/room.controller');
const roomDeviceTemp = require('../../controller/project/roomDeviceTemp.controller');

router.post('/', project.add);
router.put('/', project.update);
router.delete('/:project_id', project.delete);
router.get('/', project.getList);
router.get('/:project_id', project.getDetail);

router.post('/buildings', building.add);
router.delete('/buildings/:building_id', building.delete);
router.get('/:project_id/buildings', building.getList);

router.post('/houseTypes', houseType.add);
router.post('/houseTypes/copy', houseType.copy);
router.put('/houseTypes', houseType.update);
router.delete('/houseTypes/:house_type_id', houseType.delete);
router.get('/houseTypes', houseType.getList);
router.get('/houseTypes/:house_type_id', houseType.getDetail);

router.post('/houseTypes/:house_type_id/rooms', room.add);
router.put('/houseTypes/:house_type_id/rooms',room.update);
router.delete('/houseTypes/:house_type_id/rooms/:room_id',room.delete);
router.get('/houseTypes/:house_type_id/rooms',room.getList);
router.get('/houseTypes/:house_type_id/rooms/:room_id',room.getDetail);

router.post('/rooms/:room_id/deviceTemplets', roomDeviceTemp.add);
router.put('/rooms/:room_id/deviceTemplets', roomDeviceTemp.update);
router.delete('/rooms/:room_id/deviceTemplets/:device_templet_id', roomDeviceTemp.delete);
router.get('/rooms/:room_id/deviceTemplets', roomDeviceTemp.getList);

module.exports = router;